scoreboard players set @s rmr.entity.rotten_pillager_captain.change_state_effect_time 20

execute anchored eyes positioned ^ ^ ^6 run summon marker ~ ~ ~ {Tags:["rmr.dash_target"]}

scoreboard objectives add rmr.local.delta_x dummy
scoreboard objectives add rmr.local.delta_z dummy
scoreboard objectives add rmr.local.my_x dummy
scoreboard objectives add rmr.local.my_z dummy

execute store result score @s rmr.local.delta_x run data get entity @n[tag=rmr.dash_target] Pos[0] 100
execute store result score @s rmr.local.delta_z run data get entity @n[tag=rmr.dash_target] Pos[2] 100
execute store result score @s rmr.local.my_x run data get entity @s Pos[0] 100
execute store result score @s rmr.local.my_z run data get entity @s Pos[2] 100

scoreboard players operation @s rmr.local.delta_x -= @s rmr.local.my_x
scoreboard players operation @s rmr.local.delta_z -= @s rmr.local.my_z

execute store result entity @s Motion[0] double 0.002 run scoreboard players get @s rmr.local.delta_x
data modify entity @s Motion[1] set value 0.8
execute store result entity @s Motion[2] double 0.002 run scoreboard players get @s rmr.local.delta_z

scoreboard objectives remove rmr.local.delta_x
scoreboard objectives remove rmr.local.delta_z
scoreboard objectives remove rmr.local.my_x
scoreboard objectives remove rmr.local.my_z
kill @n[tag=rmr.dash_target]